<?php
/**
 * Created by PhpStorm.
 * User: x
 * Date: 2018/10/17
 * Time: 17:38
 */

namespace app\api\controller;

use think\Controller;
use think\Db;
use app\common\model\Phpcount as PhpcountModel;
class Phpcount extends Controller{
    private  $phpcount_model;
    public function _initialize()
    {
        parent::_initialize();
        $this->phpcount_model = new PhpcountModel();
    }

//$result = Db::name('count_detail_'.TIME_PREFIX)->insertGetId($data);

    public function phpcount($id=0,$cip=0){
        if($id){
            $data = [
                'cid' => $id,
                'count_ip' => $cip,
                'visit_time' => time()
            ];
            $result = $this->phpcount_model->save($data);
            return $result;
        }
    }

}